package models

import "gorm.io/gorm"

type User struct {
	gorm.Model
	Tel      string `gorm:"type:varchar(11)" json:"tel"`
	Password string `gorm:"type:varchar(30)" json:"password"`
}

type News struct {
	gorm.Model
	Title        string `gorm:"type:varchar(50)" json:"title"`
	Content      string `gorm:"type:text" json:"content"`
	Times        string `gorm:"type:varchar(50)" json:"times"`
	UserId       int    `gorm:"type:int" json:"user_id"`
	User         User   `gorm:"foreignKey:UserId" json:"user"`
	LikeCount    int    `gorm:"type:int" json:"like_count"`
	ConcernCount int    `gorm:"type:int" json:"concern_count"`
}

type Like struct {
	gorm.Model
	UserId int  `gorm:"type:int" json:"user_id"`
	User   User `gorm:"foreignKey:UserId" json:"user"`
	NewsId int  `gorm:"type:int" json:"news_id"`
	News   News `gorm:"foreignKey:NewsId" json:"news"`
}

type Concern struct {
	gorm.Model
	UserId int  `gorm:"type:int" json:"user_id"`
	User   User `gorm:"foreignKey:UserId" json:"user"`
	NewsId int  `gorm:"type:int" json:"news_id"`
	News   News `gorm:"foreignKey:NewsId" json:"news"`
}
